package com.kjc.demo.basic.searchalgorithm;

public class SequentialSearch {
	
	/**
	 * 	顺序查找算法
	 * */
	public static int seqSearch(int[] arr,int num) {
		int index = -1;
		for(int i=0 ;i < arr.length ; i++) {
			if(arr[i] == num) {
				return i;
			}
		}
		return index;
	}
	
	public static void main(String[] args) {
		int[] arr = {2,4,5,6,1,2,4,56,6};
		System.out.println(seqSearch(arr,56));
	}
	
}
